/**
 * @file
 * @description 用户模块接口文件
 */
import request from './request'
/**
 * @method
 * @description  登录
 * @param {Object} model 用户登录信息 
 * 
 */
export const login = (model) =>request.post('login',model);
export const user = (model) =>request.post('users',model);

export const search = (model) =>request.get('users',{
    params:model
})

export const switchState = (id,state)=>request.put(`users/${id}/state/${state}`);

export const update = (model)=>request.put(`users/${model.id}`,model);
export const deleteUser = (id)=>request.delete(`users/${id}`);
/**
 * 
 * @param {Number} userId 用户ID 
 * @param {Number} rid 角色ID
 * @returns 
 */
export const assignRole = (userId,rid)=>request.put(`users/${userId}/role`,{rid})

